Date.prototype.format = function(time, full) {
	var now = new Date().getTime();
	var interval = parseInt(now/1000 - time);

	if (full && !isSameDay(now, time*1000)) {
		var time = new Date(time*1000);	
		var day = time.getDate();
		var hour = time.getHours();
		var mins = time.getMinutes();
		return (time.getMonth() + 1) + '月' + (day<10?'0'+day:day) + '  ' + (hour<10?'0'+hour:hour) + ':' + (mins<10?'0'+mins:mins);
	}

	if (interval < 60) {
		return '刚才';
	} else if (interval < 3600) {
		return parseInt(interval / 60) + '分钟前';
	} else if (interval >= 3600 && interval <= 3600 * 24) {
		return parseInt(interval / 3600) + '小时前';
	} else {
		return parseInt(interval / (3600 * 24)) + '天前';
	}

	function isSameDay(time, time2) {
		return new Date(time).getDate() == new Date(time2).getDate();
	}
};